import QtQuick
import QtQuick.Controls
import Qt5Compat.GraphicalEffects

Item {

    width: 200
    height: 200

    Image {
        id: bug
        source: "qrc:/images/bug.jpg"
        sourceSize: Qt.size(parent.width, parent.height)
        smooth: true
        visible: false
    }

    Image {
        id: butterfly
        source: "qrc:/images/butterfly.png"
        sourceSize: Qt.size(parent.width, parent.height)
        smooth: true
        visible: false
    }

    Blend {
        id: blendEffect
        anchors.fill: bug
        source: bug
        foregroundSource: butterfly
        mode: "subtract"
    }

    // 混合模式选择器
    ComboBox {
        id: blendModeCombo
        anchors.top: parent.top
        anchors.horizontalCenter: parent.horizontalCenter
        width: 120
        height: 35
        model: ["normal", "addition", "average", "color", "colorBurn", "colorDodge", "darken", "darkerColor",
            "difference", "divide", "exclusion", "hardLight", "hue", "lighten", "lighterColor", "lightness",
            "multiply", "negation", "saturation", "screen", "subtract", "softLight"]

        onCurrentTextChanged: {
            blendEffect.mode = currentText
        }
    }
}
